<template>
  <div class="personalized">
    <div class="personalized-top">
        <h3>{{title}}</h3>
    </div>
    <div class="personalized-list">
        <div class="item" v-for="value in personalized" :key="value.id" @click="selectItem(value.id)">
            <!-- <img :src="value.picUrl" alt=""> -->
            <!-- 图片懒加载 -->
            <img v-lazy="value.picUrl" alt="">
            <p>{{value.name}}</p>
        </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'Personalized',
  props:{
      personalized:{
        type:Array,
        default:()=>[],
        required:true
      },
      title:{
          type:String,
          default:'',
          required:true
      },
      type:{
          type:String,
          default:'',
          required:true
      }
  },
  methods: {
      selectItem(id){
        //   console.log(id);
        this.$emit("select",id,this.type)
      }
  },
}
</script>
<style scoped lang="scss">
@import '../../assets/css/variable.scss';
@import '../../assets/css/mixin.scss';
.personalized{
    @include bg_sub_color();
    .personalized-top{
        width: 100%;
        height: 84px;
        @include bg_sub_color();
        border-bottom: 1px solid #ccc;
        padding: 0 20px;
        h3{
            line-height: 84px;
            @include font-size($font_large);
            font-weight:bold;
            @include font-color()
        }
    }
    .personalized-list{
        width: 100%;
        display: flex;
        justify-content: space-around;
        flex-wrap: wrap;
        padding: 20px 0;
        .item{
            width: 200px;
            padding: 20px 0;
            img{
                width: 200px;
                height: 200px;
                border-radius: 20px;
            }
            p{
                @include clamp(2);
                @include font_color();
                @include font_size($font_medium_s);
                text-align: center;
            }
        }
    }
}
</style>
